import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from "path"
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      "@": path.resolve("src"), // 源码根目录
      "@img": path.resolve("src/assets/img"), // 图片
      "@less": path.resolve("src/assets/less"), // 预处理器
      "@libs": path.resolve("src/libs"), // 本地库
      "@plugins": path.resolve("src/plugins"), // 本地插件
      "@cp": path.resolve("src/components"), // 公共组件
      "@views": path.resolve("src/views") // 路由组件
    }
  }
})
